//
//  HTGroupTableHeaderView.m
//  HeartTravel
//
//  Created by lanou on 15/10/26.
//  Copyright © 2015年 tantan. All rights reserved.
//

#import "HTGroupTableHeaderView.h"

@implementation HTGroupTableHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        CGFloat height = frame.size.height;
        _mainScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, height)];
        _mainScrollView.contentSize = CGSizeMake(4 * SCREEN_WIDTH, height);
        _mainScrollView.pagingEnabled= YES;
        _mainScrollView.delegate =self;
        self.mainScrollView.showsHorizontalScrollIndicator = NO;
        _mainScrollView.backgroundColor = [UIColor greenColor];
        for (int i = 0; i < 4; i++) {
            UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(i * SCREEN_WIDTH, 0, SCREEN_WIDTH, height)];
            imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d", i]];
            [_mainScrollView addSubview:imageView];
        }
        [self addSubview:_mainScrollView];
        
        _pageControl = [[UIPageControl alloc]initWithFrame:CGRectMake(SCREEN_WIDTH - 70, 220, 70, 30)];
        self.pageControl.numberOfPages = 4;
        self.pageControl.currentPage = 0;
        self.pageControl.currentPageIndicatorTintColor = [UIColor redColor];
        [self addSubview:_pageControl];
    }
    return self;
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
